/** Author: David Powell
This file produces Figure A6
**/

clear all
set more off
set mat 800
set seed 8721

global dir "/jules/b/dpowell"
global DATA "${dir}/purdue/replication/DATA"
global OUTPUT "${dir}/purdue/replication/output"



use ${DATA}/finaldata if year>2003 & year<2013


gcollapse *NSDUH [aw=totpop], by(nontripl year) fast

gen other=painreliever-oxy


# delimit ;


twoway (connected other year if nontripl==0 & year>2003, msize(vtiny) lwidth(thick)  color(blue) lpattern(dash)  sort yaxis(1))   (connected other year if nontripl==1 & year>2003,  lwidth(thick) msize(vtiny) color(red) sort yaxis(1)) , graphregion(color(white))  xlabel(2004(2)2012, angle(45))  ylabel(,nogrid) legend(label(2 "Non-Triplicate") label(1 "Triplicate")  rows(1) order(2 1)) xtitle("Year") ytitle("Misuse Rate (%)" ,  axis(1)) ;
gr export ${OUTPUT}/figA6b.eps, replace;


twoway (connected oxy year if nontripl==0 & year>2003, msize(vtiny) color(blue) lpattern(dash) lwidth(thick) sort yaxis(1))   (connected oxy year if nontripl==1 & year>2003,  lwidth(thick) msize(vtiny) color(red) sort yaxis(1)) , graphregion(color(white))  ylabel(,nogrid) xlabel(2004(2)2012, angle(45))  legend(label(2 "Non-Triplicate") label(1 "Triplicate")  rows(1) order(2 1)) xtitle("Year") ytitle("Misuse Rate (%)" ,  axis(1));
gr export ${OUTPUT}/figA6a.eps, replace;

# delimit cr

